package com.ews.onlineexchange.service.comparator;

import java.util.Comparator;

import com.ews.onlineexchange.model.Trade;

/**
 * 出价计算器
 * 出价低者排序靠前
 * @author admin
 *
 */
public class PriceComparator implements Comparator<Trade> {

	@Override
	public int compare(Trade o1, Trade o2) {		
		int compareTo = o1.getOffer().compareTo(o2.getOffer());
		if (compareTo != 0)
			return compareTo;
		else {			
			return new RandomComparator().compare(o1, o2);
		}
	}

}
